class LightsaberPush extends nade;

var() float     KnockbackSpeed;

simulated function Explode(vector HitLocation, vector HitNormal)
{
//	local PlayerController  LocalPlayer;
//	local Projectile P;
//	local byte i;
	local actor Victims;
	local KFMonster MonsterVictim;
	local KFHumanPawn KFHP;
	local vector pushVector;
	local rotator PointRot;	

	bHasExploded = True;
	BlowUp(HitLocation);

	//PlaySound(ExplodeSounds[rand(ExplodeSounds.length)],,2.0);
	PointRot = Instigator.GetViewRotation();
	foreach CollidingActors (class 'Actor', Victims, DamageRadius, HitLocation)
	{
		if (KFMonster(Victims) != none )
		{
			MonsterVictim = KFMonster(Victims);
			if (MonsterVictim.Physics == PHYS_Walking)
				MonsterVictim.SetPhysics(PHYS_Falling);
		
			pushVector = vector(PointRot) * KnockbackSpeed;
			if (pushVector.Z < 0)
				pushVector.Z = 0;
			
			MonsterVictim.Velocity += pushVector;
			MonsterVictim.Acceleration = vect(0,0,0);
		}
		if (KFHumanPawn(Victims) != none )
		{
			KFHP = KFHumanPawn(Victims);
			if (KFHP.Physics == PHYS_Walking)
				KFHP.SetPhysics(PHYS_Falling);
		
			pushVector = vector(PointRot) * KnockbackSpeed;
			if (pushVector.Z < 0)
				pushVector.Z = 0;
			
			KFHP.Velocity += pushVector;
			KFHP.Acceleration = vect(0,0,0);
		}
	}
	Destroy();
}


/*
simulated function HurtRadius( float DamageAmount, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HitLocation )
{
	local actor Victims;
	local float damageScale, dist;
	local vector dir;
	local int NumKilled;
	local KFMonster KFMonsterVictim;
	local Pawn P;
	local KFPawn KFP;
	local array<Pawn> CheckedPawns;
	local int i;
	local bool bAlreadyChecked;
	local rotator PointRot;	

	if ( bHurtEntry )
		return;

	bHurtEntry = true;
	
	

	foreach CollidingActors (class 'Actor', Victims, DamageRadius, HitLocation)
	{
		// don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
		if( (Victims != self) && (Hurtwall != Victims) && (Victims.Role == ROLE_Authority) && !Victims.IsA('FluidSurfaceInfo')
		 && ExtendedZCollision(Victims)==None )
		{
			P = Pawn(Victims);

			if( P != none )
			{
		        for (i = 0; i < CheckedPawns.Length; i++)
				{
		        	if (CheckedPawns[i] == P)
					{
						bAlreadyChecked = true;
						break;
					}
				}

				if( bAlreadyChecked )
				{
					bAlreadyChecked = false;
					P = none;
					continue;
				}

                KFMonsterVictim = KFMonster(Victims);

    			if( KFMonsterVictim != none && KFMonsterVictim.Health <= 0 )
    			{
                    KFMonsterVictim = none;
    			}

                KFP = KFPawn(Victims);

				CheckedPawns[CheckedPawns.Length] = P;

				if ( damageScale <= 0)
				{
					P = none;
					continue;
				}
				else
				{
					//Victims = P;
					P = none;
				}
			}
        }
	}

	bHurtEntry = false;
}
*/

defaultproperties
{
     KnockbackSpeed=700.000000
     DisintegrateSound=None
     ExplodeSounds(0)=None
     ExplodeSounds(1)=None
     ExplodeSounds(2)=None
     ExplodeTimer=0.100000
     Damage=0.000000
     DamageRadius=1420.000000
     MomentumTransfer=300000.000000
     ExplosionDecal=None
     StaticMesh=None
}
